package main

import "fmt"

// 声明一种数据类型，int的别名
type myint int

// 定义一个结构体
type Book struct {
	title string
	auth  string
}

func main() {
	var a myint = 10
	fmt.Println("a=", a)
	fmt.Printf("type of a=%T\n", a)

	var book1 Book
	book1.title = "golang"
	book1.auth = "zhangsan"
	fmt.Printf("book1=%v\n", book1)

	changeBook1(book1)
	fmt.Printf("book1=%v\n", book1)

	changeBook2(&book1)
	fmt.Printf("book1=%v\n", book1)
}

func changeBook1(book Book) {
	//传递一个book的副本
	book.auth = "666"
}

func changeBook2(book *Book) {
	//传递一个指针
	book.auth = "777"
}
